package com.springcloud.zuul.config;

import com.springcloud.zuul.common.utlis.JsonResult;
import com.springcloud.zuul.fallback.CustomFallbackProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

@SpringBootConfiguration
public class CustomFallBackConfiguration {

    @Bean(value = "producer1")
    public CustomFallbackProvider producer1FallBack() {
        String json = JsonResult.error("producer1服务器异常").toJson();
        return new CustomFallbackProvider("producer", json);
    }

    @Bean(value = "producer2")
    public CustomFallbackProvider producer2FallBack() {
        String json = JsonResult.error("producer2服务器异常").toJson();
        return new CustomFallbackProvider("producer1", json);
    }

}
